package com.demo.app.module.user;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/user")
public class UserController {
	
	@RequestMapping("/userlist")
	public String userlist(Model model) {
		RoleInfo role=new RoleInfo();
		role.setDesc("系统管理员。。。");
		role.setId("1");
		role.setName("系统管理员");
		
		RoleInfo role1=new RoleInfo();
		role1.setDesc("程序管理员。。。");
		role1.setId("2");
		role1.setName("程序管理员");
		
		RoleInfo role2=new RoleInfo();
		role2.setDesc("文档管理员。。。");
		role2.setId("3");
		role2.setName("文档管理员");
		
		RoleInfo role3=new RoleInfo();
		role3.setDesc("用户管理员。。。");
		role3.setId("4");
		role3.setName("用户管理员");
		
		List<RoleInfo> list=new ArrayList<RoleInfo>();
		list.add(role);
		list.add(role1);
		list.add(role2);
		list.add(role3);
		
		model.addAttribute("roles",list);
		
		return "/user/admin-role";
	}
	
	@RequestMapping("/adduser")
	public String adduser(Model model) {
		
		return "/user/admin-role-add";
	}
	
	@RequestMapping("/save")
	@ResponseBody
	public String saveRole(RoleInfo role) {
		if(null !=role)
		{
			role.setId(String.valueOf(System.currentTimeMillis()));
		
		}
		
		
		return"xxx";
	}
	
	

}
